import {types, flow} from "mobx-state-tree";
import * as api from "./requests";

export const Home = types
  .model("Home", {})
  .volatile(self => ({
    name: "home",
    userInfo: {
      name: "store-name",
      pin: "store-pin"
    }
  }))
  .views(self => ({}))
  .actions(self => ({
    getUserInfo: flow(function * (params) {
      const res = yield api.getUserInfo(params);
      console.log('getUserInfo', res.data);
      self.userInfo = res.data.data;
    })
  }));
